FROM php:7.4-fpm

LABEL maintainer="test@test.com"
RUN apk add --no-cache libzip-dev\
    && docker-php-ext-configure zip --with-libzip=/usr/include
RUN apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev \
    && docker-php-ext-configure gd  --with-png-dir=/usr/include/ \
       --with-jpeg-dir=/usr/include/ \
       --with-freetype-dir=/usr/include/ \
    && docker-php-ext-install -j$(getconf _NPROCESSORS_ONLN) gd \
    && apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev

RUN docker-php-ext-install iconv pdo_mysql zip opcache bcmath mbstring

RUN apk add --no-cache autoconf gcc g++ make libmcrypt libmcrypt-dev librdkafka librdkafka-dev
RUN pecl install rdkafka redis \
    && docker-php-ext-enable rdkafka  redis\
    && apk del --no-cache autoconf gcc g++ make libmcrypt-dev librdkafka-dev

RUN mv /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini \
    && sed -i 's/memory_limit = 128M/memory_limit = 4096M/; s/upload_max_filesize = 2M/upload_max_filesize = 200M/; s/post_max_size = 8M/post_max_size = 200M/; s/;opcache.enable=1/opcache.enable=1/; s/max_execution_time = 30/max_execution_time = 300/' /usr/local/etc/php/php.ini \
    && sed -i 's/pm.max_children = 5/pm.max_children = 10/; s/;pm.status/pm.status/' /usr/local/etc/php-fpm.d/www.conf
#RUN echo -e 'xdebug.remote_enable=1\nxdebug.remote_host=host.docker.internal\nxdebug.remote_port=9000\nxdebug.idekey=PHPSTORM' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

WORKDIR /var/www/html
